﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using University.Workshop.DataAccess;
using University.Workshop.Model;
using System.Data;

namespace University.Workshop.Business
{
    public static class SaleController
    {
        public static void SaleRegister(Sale sale)
        {
            SaleDataAccess.SaleRegister(sale);
        }

        public static DataTable GetProductRow(string productCode)
        {
            return SaleDataAccess.GetProductRow(productCode);
        }

        public static void SaleDetailRegister(SaleDetail saleDetail)
        {
            SaleDataAccess.SaleDetailRegister(saleDetail);
        }

        public static string GetSaleCode()
        {
            DataTable table = SaleDataAccess.GetSaleCode();
            return (Convert.ToDouble(table.Rows[0].ItemArray[0].ToString(), System.Globalization.CultureInfo.CurrentCulture) + 1).ToString(System.Globalization.CultureInfo.CurrentCulture);
        }
        public static DataTable SuggestionProduct(string suggestion)
        {
            return SaleDataAccess.SuggestionProduct(suggestion);
        }
    }
}
